package com.greenold.dashboard.controller;

import com.greenold.common.core.domain.AjaxResult;
import com.greenold.dashboard.service.IDashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author YueYang
 * Created on 2025/10/17 11:50
 * @version 1.0
 * 工作台相关的请求接口
 */
@RestController
@RequestMapping("/dashboard")
public class DashboardController {
    @Autowired
    private IDashboardService dashboardService;

    /**
     * 获取前端工作台饼图数据
     *
     * @return 前端工作台饼图数据
     */
    @GetMapping("/topPie")
    public AjaxResult getTopPie() {
        return AjaxResult.success(dashboardService.getTopPie());
    }

    /**
     * 获取当前登录用户的信息
     *
     * @return 当前登录用户的信息
     */
    @GetMapping("/userinfo")
    public AjaxResult getUserinfo() {
        return AjaxResult.success(dashboardService.getUserinfo());
    }

    //获取代办任务列表
    @GetMapping("/todoTask")
    public AjaxResult getTodoTask() {
        return AjaxResult.success(dashboardService.getTodoTask());
    }

    /**
     * 获取老人等级分布
     *
     * @return 老人等级分布
     */
    @GetMapping("/elderLevel")
    public AjaxResult getElderLevel() {
        return AjaxResult.success(dashboardService.getElderLevel());
    }

    /**
     * 获取老人年龄分布
     *
     * @return 老人年龄分布
     */
    @GetMapping("/elderAge")
    public AjaxResult getElderAge() {
        return AjaxResult.success(dashboardService.getElderAge());
    }

    /**
     * 雷达图服务能力分布
     *
     * @return 服务能力分布
     */
    @GetMapping("/serviceAbility")
    public AjaxResult getServiceAbility() {
        return AjaxResult.success(dashboardService.getServiceAbility());
    }
}
